# Title     : TODO
# Objective : TODO
# Created by: Administrator
# Created on: 2019/7/24

library(ggrepel)
library(ropls)
library(pROC)
library(egg)
library(randomForest)
library(Boruta)
library(magrittr)
library(optparse)
require(gbm)
library(caret)
library(tidyverse)

createWhenNoExist <- function(f) {
  !dir.exists(f) && dir.create(f)
}

option_list <- list(
  make_option("--i", default = "data.csv", type = "character", help = "metabolite data file"),
  make_option("--g", default = "group.csv", type = "character", help = "sample group file"),
  make_option("--sc", default = "sample_color.txt", type = "character", help = "sample color file"),
  make_option("--index", default = "", type = "character", help = "index")

)
opt <- parse_args(OptionParser(option_list = option_list))

options(digits = 3)

parent <- paste0("./")
createWhenNoExist(parent)

data <- read_csv(str_c("data.csv"),col_types = cols(.default = "c"),locale = locale(encoding = "UTF-8"))  %>%
  gather("Metabolite", "Value", -SampleID) %>%
  spread(SampleID, "Value")

write_csv(data,"data_no_na.csv")











